<script setup>
import {formatPrice} from "@/utils/format.js"
// import {routerTo} from "@/utils/common.js"
</script>

<template>
	
	<view class="card-goods-item" >
		<view class="pic">
			<image class="img" src="/static/tmp_goods.jpg" mode="aspectFill"></image>
		</view>
		<view class="info">
			<view class="title">测试商品名称测试商品名称测试商品名称测试商品名称</view>
			<view class="price">
				<view class="new">
					<view class="small">￥</view>
					<view class="text">{{formatPrice(5688)}}</view>
				</view>
				<view class="old">￥{{formatPrice(12332)}}</view>
			</view>
		</view>
	</view>
</template>

<style lang="scss" scoped>
	.card-goods-item{
		//自定义比例
		.pic{
			width: 100%;aspect-ratio: 1 / 1;
			.img{width: 100%;height: 100%;border-radius: 16rpx;}
		}
		.info{
			padding:16rpx 0;
			.title{font-size: 30rpx;color:#333;font-weight: bold;
			white-space: nowrap; /* 强制文本不换行 */
			overflow: hidden; /* 隐藏超出部分 */
			text-overflow: ellipsis; /* 超出部分显示省略号 */}
			.price{
				display: flex;gap:16rpx;align-items: flex-end;padding-top:10rpx;
				.new{
					display: flex;align-items: flex-end;font-size: 32rpx;
					font-weight: bolder;color:$uni-color-error;
					// 新价格文字
					.small{font-size: 24rpx;}
				}
				.old{font-size: 20rpx;color:#bbb;text-decoration: line-through;}
			}
		}
		}
</style>